
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Google Maps</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
  </head>
  <body>

    
    <div id="map" style="width:600px;height:400px;"></div>
    <div id="messages"></div>

    <script type="text/javascript">
    //<![CDATA[
    

    // delay between geocode requests - at the time of writing, 100 miliseconds seems to work well
    var delay = 100;


      // ====== Create map objects ======
      var infowindow = new google.maps.InfoWindow();
      var latlng = new google.maps.LatLng(-34.397, 150.644);
      var mapOptions = {
        zoom: 8,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      var geo = new google.maps.Geocoder(); 
      var map = new google.maps.Map(document.getElementById("map"), mapOptions);
      var bounds = new google.maps.LatLngBounds();

      // ====== Geocoding ======
      function getAddress(search, next) {
        geo.geocode({address:search}, function (results,status)
          { 
            // If that was successful
            if (status == google.maps.GeocoderStatus.OK) {
              // Lets assume that the first marker is the one we want
              var p = results[0].geometry.location;
              var lat=p.lat();
              var lng=p.lng();
              // Output the data
                var msg = 'address="' + search + '" lat=' +lat+ ' lng=' +lng+ '(delay='+delay+'ms)<br>';
                document.getElementById("messages").innerHTML += msg;
              // Create a marker
              createMarker(search,lat,lng);
            }
            // ====== Decode the error status ======
            else {
              // === if we were sending the requests to fast, try this one again and increase the delay
              if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
                nextAddress--;
                delay++;
              } else {
                var reason="Code "+status;
                var msg = 'address="' + search + '" error=' +reason+ '(delay='+delay+'ms)<br>';
                document.getElementById("messages").innerHTML += msg;
              }   
            }
            next();
          }
        );
      }

     // ======= Function to create a marker
     function createMarker(add,lat,lng) {
       var contentString = add;
       var marker = new google.maps.Marker({
         position: new google.maps.LatLng(lat,lng),
         map: map,
         zIndex: Math.round(latlng.lat()*-100000)<<5
       });

      google.maps.event.addListener(marker, 'click', function() {
         infowindow.setContent(contentString); 
         infowindow.open(map,marker);
       });

       bounds.extend(marker.position);

     }

      // ======= An array of locations that we want to Geocode ========
      var addresses = [
               'buenos aires, capital federal, Riobamba 345',
				'buenos aires, capital federal, Esmeralda 1040',
				'buenos aires, capital federal, Peru 342',
				'buenos aires, capital federal, Sarmiento 1656',
				'buenos aires, capital federal, Lavalle 343',
				'buenos aires, capital federal, Rogelio Yrurtia 6020',
				'buenos aires, capital federal, Quintana 362',
				'buenos aires, capital federal, Av. Mosconi 2883',
				'buenos aires, capital federal, Rivadavia 7514',
				'buenos aires, capital federal, Sarmiento 1728',
				'buenos aires, capital federal, Av San MArtín 6628',
				'buenos aires, capital federal, J.E. Uriburu 1721',
				'buenos aires, capital federal, Sarmiento 1752',
				'buenos aires, capital federal, Balcarce 678',
				'buenos aires, capital federal, Av. Corrientes 3328',
				'buenos aires, capital federal, F. Alcorta 7536',
				'buenos aires, capital federal, Av. Córdoba 634',
				'buenos aires, capital federal, F. Alcorta 6438',
				'buenos aires, capital federal, Av. Rivadavia 7425',
				'buenos aires, capital federal, Adolfo Alsina 934',
				'buenos aires, capital federal, Niceto Vega 5508',
				'buenos aires, capital federal, Olga Cosenttini 751',
				'buenos aires, capital federal, José A. Cabrerea 3046',
				'buenos aires, capital federal, Av. Santa Fe 4389',
				'buenos aires, capital federal, Vicente Lopez 2188',
				'buenos aires, capital federal, Borges 2450',
				'buenos aires, capital federal, José Martí 17',
				'buenos aires, capital federal, Cecilia Grierson 225',
				'buenos aires, capital federal, Av. Rivadavia 7428',
				'buenos aires, capital federal, Av. Cabildo 2040',
				'buenos aires, capital federal, Olleros 1775',
				'buenos aires, capital federal, Junin 1735',
				'buenos aires, capital federal, Junin 1715',
				'buenos aires, capital federal, Ecuador 60',
				'buenos aires, capital federal, Rivadavia 7802',
				'buenos aires, capital federal, O´brien 1160',
				'buenos aires, capital federal, Av. Nazca 55',
				'buenos aires, capital federal, Av. Rafael Obligado 1221',
				'buenos aires, capital federal, Av. San Martín 6101',
				'buenos aires, capital federal, Peru 529',
				'buenos aires, capital federal, Viamonte 2168',
				'buenos aires, capital federal, Vicente Lopez 2233',
				'buenos aires, capital federal, Araoz 2422',
				'buenos aires, capital federal, Rafael Obligado y Sarmiento',
				'buenos aires, capital federal, R. Obligado 3731',
				'buenos aires, capital federal, Agüero 512',
				'buenos aires, capital federal, Sarmiento 1374',
				'buenos aires, capital federal, Av. Rivadavia 3469',
				'buenos aires, capital federal, F. Lacroze 3453',
				'buenos aires, capital federal, Vicente Lopez 2134',
				'buenos aires, capital federal, Bartolome Mitre 2737',
				'buenos aires, capital federal, Av. Corrientes 3530',
				'buenos aires, capital federal, Av Cabildo 4665',
				'buenos aires, capital federal, Rodriguez Peña 1220',
				'buenos aires, capital federal, Figueroa Alcorta 7474',
				'buenos aires, capital federal, Mexico 1861',
				'buenos aires, capital federal, Av. La Plata 731',
				'buenos aires, capital federal, Suipacha 930',
				'buenos aires, capital federal, Niceto Vega 5635',
				'buenos aires, capital federal, O`brien 1232',
				'buenos aires, capital federal, Sarmiento 777',
				'buenos aires, capital federal, Gascon 1036',
				'buenos aires, capital federal, Av. De Mayo 948',
				'buenos aires, capital federal, Reconquista 876',
				'buenos aires, capital federal, Av. Costanera Rafael Obligado y La Pampa',
				'buenos aires, capital federal, Azcuenaga 1902',
				'buenos aires, capital federal, Agüero 445',
				'buenos aires, capital federal, Av. Rivadavia 1908',
				'buenos aires, capital federal, Salta 1736',
				'buenos aires, capital federal, Rivadavia 7523',
				'buenos aires, capital federal, Junin 1787',
				'buenos aires, capital federal, Av. Libertador 3883',
				'buenos aires, capital federal, Av Juan B. Justo 1625',
				'buenos aires, capital federal, Av. Rivadavia 10925',
				'buenos aires, capital federal, Esmeralda 565',
				'buenos aires, capital federal, A. Moreau De Justo 2092',
				'buenos aires, capital federal, A. Moreau De Justo 102',
				'buenos aires, capital federal, Av. Alvarez Thomas 1391',
				'buenos aires, capital federal, J.L. Borges 1640',
				'buenos aires, capital federal, Azcuenaga 1775',
				'buenos aires, capital federal, Guardia Vieja 3360',
				'buenos aires, capital federal, Balcarce 563',
				'buenos aires, capital federal, Humberto Primo 1783',
				'buenos aires, capital federal, Rodiguez Peña 1082',
				'buenos aires, capital federal, Santa Fe 4999',
				'buenos aires, capital federal, Av. Saenz 459',
				'buenos aires, capital federal, Av. Boyaca 28',
				'buenos aires, capital federal, Honduras 5339',
				'buenos aires, capital federal, Balcarce 425',
				'buenos aires, capital federal, Av. Rivadavia 878',
				'buenos aires, capital federal, Vicente Lopez 2056',
				'buenos aires, capital federal, Av.Rafael Obligado 4801',
				'buenos aires, capital federal, Ayacucho 1981',
				'buenos aires, capital federal, Scalabrini Ortiz 1425',
				'buenos aires, capital federal, Juana Manso 305',
				'buenos aires, capital federal, Juramento 1531',
				'buenos aires, capital federal, Av. Rafael Obligado 1221',
				'buenos aires, capital federal, Av. Juan B. Alberdi 2829',
				'buenos aires, capital federal, Av. Hipoílito Irigoyen 968',
				'buenos aires, capital federal, Av. Rivadavia 7217',
				'buenos aires, capital federal, Av. Córdoba 543',
				'buenos aires, capital federal, Chacabuco 947',
				'buenos aires, capital federal, Av. Santa Fé 3651',
				'buenos aires, capital federal, Niceto Vega 5681',
				'buenos aires, capital federal, Av. Juan B. Justo 1658',
				'buenos aires, capital federal, Av. Cordoba 2988',
				'buenos aires, capital federal, Av. Hipólito Yrigoyen 947',
				'buenos aires, capital federal, Honduras 5535',
				'buenos aires, capital federal, Av. Niceto Vega 5534',
				'buenos aires, capital federal, Av. Rafael Obligado 6211',
				'buenos aires, capital federal, A. Moreau De Justo 1007',
				'buenos aires, capital federal, Sarmiento 667',
				'buenos aires, capital federal, Suipacha 842',
				'buenos aires, capital federal, Figueroa Alcorta 2270',
				'buenos aires, capital federal, Hipolito Yrigoyen 847',
				'buenos aires, capital federal, Santos Dumont 4056',
				'buenos aires, capital federal, Av. Santa Fe 4389',
				'buenos aires, capital federal, Balcarce 563',
				'buenos aires, capital federal, Av. Beiro 3124',
				'buenos aires, capital federal, Rafael Obligado Y Sarmiento',
				'buenos aires, capital federal, Av. Cabildo 3241',
				'buenos aires, capital federal, Suipacha 586',
				'buenos aires, capital federal, Darwin 1574',
				'buenos aires, capital federal, Av. Rivadavia 9131',
				'buenos aires, capital federal, Av. Rafael Obligado 6201',
				'buenos aires, capital federal, Emma De La Barra 333',
				'buenos aires, capital federal, Perú 529',
				'buenos aires, capital federal, Av. Juan B. Justo 1659',
				'buenos aires, capital federal, Av. Diaz Velez 4820',
				'buenos aires, capital federal, Honduras 5445',
				'buenos aires, capital federal, Montevideo 306',
				'buenos aires, capital federal, Av. Beiro 3334',
				'buenos aires, capital federal, Av. Juan B. Justo 1574',
				'buenos aires, capital federal, Av. Scalabrini Ortiz 1648',
				'buenos aires, capital federal, Av. Dorrego 1735',
				'buenos aires, capital federal, Av. Sarmiento y Casares',
				'buenos aires, capital federal, Av. Niceto Vega 5452',
				'buenos aires, capital federal, Balcarce 605',
				'buenos aires, capital federal, Ugarte 1640'
      ];

      // ======= Global variable to remind us what to do next
      var nextAddress = 0;

      // ======= Function to call the next Geocode operation when the reply comes back

      function theNext() {
        if (nextAddress < addresses.length) {
          setTimeout('getAddress("'+addresses[nextAddress]+'",theNext)', delay);
          nextAddress++;
        } else {
          // We're done. Show map bounds
          map.fitBounds(bounds);
        }
      }

      // ======= Call that function for the first time =======
      theNext();

    // This Javascript is based on code provided by the
    // Community Church Javascript Team
    // http://www.bisphamchurch.org.uk/   
    // http://econym.org.uk/gmap/

    //]]>
    </script>
  </body>

</html>




